﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Web;
using System.Web.SessionState;

namespace Gencode.Web.Common
{
    public class gConfig
    {
        #region members
        private static gConfig _instance = null;
        #endregion

        #region Propertys
        public static bool IsRootApp
        {
            get
            {
                return HttpContext.Current.Request.ApplicationPath == "/";
            }
        }

        public static gConfig Instance
        {
            get
            {
                if (_instance == null)
                    CreateInstance();

                return _instance;
            }
        }

        public HttpSessionState Session
        {
            get
            {
                return HttpContext.Current.Session;
            }
        }

        public HttpApplicationState Application
        {
            get
            {
                return HttpContext.Current.Application;
            }
        }
        #endregion

        #region implementation
        private static void CreateInstance()
        {
            if (_instance != null)
                return;

            _instance = new gConfig();
        }
        #endregion
    }
}
